-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gcc: don't use old cross-compiler build a new native compiler #249301
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This commit lifts the default gcc version to a top-level attribute so it can be overridden.
This commit causes `gccFun` to use `callPackage` with an argument `gcc_major_version` to indicate which version of gcc is desired. It defaults to `default-gcc-version`.
This is stylistic; this code has been inherited from quite a long time ago, and I never understood what the `1` meant. Let's just use `binutilsNoLibc.libc`, which is what `libcCross1` is defined to be, instead.
This commit causes `gccWithoutTargetLibc` to use `callPackage` with an argument `gcc_major_version` to indicate which version of gcc is desired. It defaults to `default-gcc-version`.
…uild gccWithoutTargetLibc is useful not only for building cross compilers, but also for cross-building native compilers. Let's allow it to be used in that situation.
This commit simply changes ``` pkg = lowPrio (wrapCC ... ) ``` into ``` pkg = ... ``` and wraps the sole occurrence of `pkg` with `lowPrio (wrapCC ... )`. It has no effect on eval. I am placing it in a separate commit simply to make the next commit easier to understand.
This commit checks that libgcc is being built by gcc, and that the gcc it is being built by is exactly the same version. Any other combination of compiler and libgcc is unlikely to work.
Closes #244871 This commit checks for the following situation: we are cross-building a native compiler (build!=(host==target)) using a cross-compiler ((build==host)!=target) which is *older than* the compiler being built. We check both the cross-compiler itself as well as the cross-compiler which was used to build the copy of libgcc against which the target libc is linked. This configuration often fails (see #244871 for one example). If you need to cross-build a newer-than-default-gcc-version native compiler, you must first build a newer-than-default-gcc-version cross-compiler. Previously, the user had to figure out how to hack in this upgrade on their own. The code added by this commit inserts the extra compiler build automatically.
This was referenced Aug 15, 2023
ghost
changed the title
gcc: do not use an old cross-compiler build a new native compiler
gcc: don't use old cross-compiler build a new native compiler
Aug 15, 2023
ofborg
bot
added
the
6.topic: cross-compilation
Building packages on a different platform than they will be used on
label
Aug 15, 2023
ghost
closed this
Jan 23, 2024
ghost
deleted the
pr/gcc/never-build-with-older-compiler
branch
January 23, 2024 06:48
This pull request was closed.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
6.topic: cross-compilation
Building packages on a different platform than they will be used on
0 participants
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
Closes #244871
This commit checks for the following situation: we are
build!=(host==target)
(build==host)!=target
which is older than the compiler being built.This configuration often fails (see #244871 for one example).
We check both the cross-compiler itself as well as the cross-compiler which was used to build the copy of libgcc against which the target libc is linked.
An example of this situation would be
since the current nixpkgs default version of gcc is
gcc12
.If you need to cross-build a newer-than-default-gcc-version native compiler for a different platform, you must first build a newer-than-default-gcc-version cross-compiler which targets that platform. Previously, the user had to figure out how to hack in this upgrade on their own. The code added by this commit inserts the extra compiler build automatically. There are fallback
assert
s to warn us if this automation for some reason does not kick in (or you use.overrideAttrs
to circumvent it).Things done
x86_64-linux
)x86_64-linux
)